<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@	page import="org.corp.agi.web.constant.WebConstant"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="cd" uri="/WEB-INF/tld/commondisplay-tag.tld"%>
<%@ include file="/ncos/templates/templateConstants.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${ initParam.appName }</title>
<link href="${ requestScope.cssBase }/style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="${requestScope.jsBase }/imageutils.js"></script>
<!-- yav validation -->
<link rel="stylesheet" href="${requestScope.agiCssBase}/yav-style.css " type="text/css" />
<script type="text/javascript" src="${requestScope.agiJSBase}/yav.js"></script>
<script type="text/javascript" src="${requestScope.agiJSBase}/yav-config.js"></script>
<!-- jQuery -->
<script type="text/javascript" src="${requestScope.jsBase}/jquery-1.7.2.min.js"></script>
<%@include file="/ncos/templates/commonDWR.jspf"%>
<script type="text/javascript">
	var $j = jQuery.noConflict();
</script>
</head>

<body class="body">
	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td>
				<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td colspan="4"><img src="${ imageBase }/namecard_bg_01.png" width="780" height="29" alt=""></td>
					</tr>
					<tr>
						<td width="29" rowspan="3" background="${ imageBase }/namecard_bg_02.png">
							<!--<img src="${ imageBase }/namecard_bg_02.png" width="29" height="1" alt="">-->
						</td>
						<td width="322" height="54" bgcolor="#dfeeee">
							<img src="${ imageBase }/logo-mittare.png" width="300" height="55"></td>
						<td width="400" bgcolor="#dfeeee">
							<table width="400" border="0" align="right" cellpadding="0" cellspacing="0" class="font05">
								<tr>
									<td>หน้าหลัก<a href="#">&nbsp;&nbsp;&nbsp;</a>
									<!-- <a href="contact.html">ติดต่อสอบถาม</a> -->
									</td>
								</tr>
							</table>
						</td>
						<td width="29" rowspan="3" background="${ imageBase }/namecard_bg_04.png">
							<!--<img src="${ imageBase }/namecard_bg_04.png" width="29" height="1" alt="">-->
						</td>
					</tr>
					<tr>
						<td height="15" colspan="2" valign="top" bgcolor="#dfeeee"></td>
					</tr>
					<tr>
						<td colspan="2" valign="top" bgcolor="#cfe6e6">
							<table width="722" border="0" cellpadding="0" cellspacing="0"
								class="bg3">
								<tr>
									<td width="50%" valign="top"><table width="300"
											height="40" border="0" align="left" cellpadding="0"
											cellspacing="0">
											<tr>
												<td class="font02">กรุณาเข้าสู่ระบบ เพื่อสั่งนามบัตร</td>
											</tr>
										</table></td>
									<td width="50%">
									<c:if test="${empty sessionScope[request.SESSION_USERBEAN_KEY]}">
											<form id="loginForm" action="login-login.htm" method="POST" autocomplete="off">
												<table width="250" height="144" border="0" align="left" cellpadding="0" cellspacing="0">
													<tr>
														<td height="34" colspan="2">&nbsp;</td>
													</tr>
													<tr>
														<td width="77" height="30" class="font07">ชื่อผู้ใช้งาน</td>
														<td width="173"><label for="username"></label><input name="username" type="text" class="form_user_pass" id="username"><br />
														<span id="errorsDiv_username"></span></td>
													</tr>
													<tr>
														<td height="30" class="font07">รหัสผ่าน</td>
														<td height="30"><label for="password"></label><input name="password" type="password" class="form_user_pass" id="password"><br />
														<span id="errorsDiv_password"></span></td>
													</tr>
													<tr>
														<td height="30">&nbsp;</td>
														<td height="30"><input type="button" value="เข้าสู่ระบบ" onclick="doLoginForm()"><%--&nbsp; <input type="button" value="Clear" onclick="clearForm();"> --%></td>
													</tr>
													<tr>
														<td height="30">&nbsp;</td>
														<td class="font06" style="color: red;">
															<div id="alert" class="alert" style="display: none;"></div>
														</td>
													</tr>
												</table>
											</form>
										</c:if>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<table width="680" height="200" bgcolor="#ffffff" border="0" align="center" cellpadding="20" cellspacing="0">
											<tr>
												<td valign="top" class="font05">
													<p class="font05_2">
														หากพบปัญหา หรือข้อสงสัยการใช้งาน กรุณาแจ้งมาที่
														081-413-8639  หรือ E-mail : <a href="mailto:print.post99@gmail.com">print.post99@gmail.com</a><br>
														ในวันและเวลาทำการ วันจันทร์ - ศุกร์ เวลา 8.30 น. - 17.30
														น. เว้นวันหยุดราชการ และวันหยุดนักขัตฤกษ์
													</p>
													<p class="font05_3">
														<img src="${ imageBase }/logo-print.png" width="191" height="54"><br>
														<strong>บริษัท พรินต์ แอต โพสต์ จำกัด (ผู้ให้บริการจัดพิมพ์นามบัตรมิตรแท้อย่างเป็นทางการ)</strong><br>
														370/8 อาคารสุภัทรา ชั้น 4  ถนนพระราม 9 แขวงบางกะปิ
														เขตห้วยขวาง กรุงเทพฯ 10310<br> ติดต่อ E-mail :
														<a href="mailto:print.post99@gmail.com">print.post99@gmail.com</a> โทร. 0-2719-7575 ต่อ 24, 081-413-8639
														แฟกซ์ 0-2719-7579
													</p>
												</td>
											</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td colspan="2">&nbsp;</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td height="29" colspan="4" background="${ imageBase }/namecard_bg_06.png" class="font00">Copyright © 2013 Print at Post All rights reserved.</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
<script language="javascript">
function doLoginForm()
{
	var rules=new Array();
    rules[0] = 'username:User Name|required';
    rules[1] = 'password:Password|required';

    //if (yav.performCheck('loginForm', rules, 'inline')){
   	if (yav.performCheck('loginForm', rules, 'classic')){
    	$j("#loginForm").submit();
    }
	
}
function clearForm()
{
	$j('#username').val('');
	$j('#password').val('');
	$j('#roleOption').val('');
	$j('#role').val($j('#roleOption').val());
	$j('#alert').fadeOut(500);
	$j('.innerError').html('').removeClass('innerError');
}
$j("input[name='password']").keypress(function(event){
		if(event.which==13){
			doLoginForm();
		}
	});
	
$j(document).ready(function(event){
	//test();
});
function test(){
	if($j.browser.msie){
		$j('#username').val('approver1');
		$j('#password').val('password');
	}else{
		$j('#username').val('user1');
		$j('#password').val('password');
	}
	$j('#loginForm').submit();
}
function showResponse(responseText, statusText, isErrorPage) {
	//error/warning/info
	eval( "var o = " + responseText + "" );
	var status = o.status;
	var content = "";
	if (o.messageList != null) {
		for (var i=0; i<o.messageList.length; i++) {
			//content += "<strong>" + o.messageList[i].messageCode + "</strong>"+" : "+o.messageList[i].messageText+"<br/>";
			content += o.messageList[i].messageText+"<br/>";
		}
	}
	
	$j("#alert").html(content).show();
	$j("#username").focus();
}
showResponse('{'
		+'"status":"${sessionScope.SESSION_STATUS_KEY}",'
		+'"messageList":${cd:escJS(sessionScope.SESSION_MESSAGE_KEY)}}',
		''); 
</script>
</body>
</html>
